<%--
  Created by IntelliJ IDEA.
  User: 叶叶
  Date: 2022/2/20
  Time: 19:20
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>内部生产</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.css">
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
    <script src="https://unpkg.com/bootstrap-table@1.15.3/dist/bootstrap-table.min.js"></script>
    <script src="../js/bootstrap-table-zh-CN.min.js"></script>
</head>
<body>
<div class="container" id="div1">
    <span style="color: blue;font-family: 华文宋体"><marquee width=400 direction=left align=middle><span>您正在做的业务是：生产管理--内部生产管理--生产登记（ 责任人控制）
</span></marquee></span>
    <!--      <div class="row" style="margin-top: 20px">-->
    <!--          <div class="col-10">-->
    <!--          </div>-->
    <!--          <div class="col-2">-->
    <!--              <button class="btn btn-primary" data-toggle="modal" data-target="#myModal" onclick="add1()">添加</button>-->
    <!--          </div>-->
    <!--      </div>-->
    <div class="container">
        <div class="row">
            <caption>
                <div style="float: right;margin-bottom: 5px">
                </div>
            </caption>
            <table id="table" class="table table-hover table-bordered" style="width: 1100px">
                <thead>


                </thead>
                <tbody>

            </table>
        </div>
    </div>
</div>

<DIV class=DIV_STYLE2 style="display: none" id="div2"><TABLE cellSpacing=0 cellPadding=0 width=1000 align=center bgColor=#ffffff border=0>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width="100%" border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width=1000>
                            <TBODY>
                            <TR>
                                <TD>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center><FONT size=4><B>生产派工单</B></FONT></TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE id=theObjTable class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>派工单编号：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="pgd"></span>&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="16%" borderColorDark=#eeeeee align=right>出库单编号：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left>&nbsp<span id="ckd"></span></TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>产品编号：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="cpbh"></span>&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>产品名称：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="cpmc"></span>&nbsp;</TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>描述&nbsp;&nbsp;&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left>&nbsp<span id="ms"></span></TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>数量&nbsp;&nbsp;&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="sl"></span>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE id="table2" class=TABLE_STYLE5  borderColor=#000000 cellSpacing=0 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1>
                                        <TBODY>
                                        <TR class=TR_STYLE2 height=20 bgColor=#d2e9ff>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="8%" align=left>工序名称</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>设计工时数</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>实际工时数</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>设计工时成本(元)</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>实际工时成本</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>设计物料成本(元)</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>实际物料成本</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>工序登记</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="7%" align=left>&nbsp;</TD></TR>




                                        </TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>设计工时总成本：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="sjcb"></span>&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="16%" borderColorDark=#eeeeee align=right>设计物料总成本：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="sjwlcb"></span>&nbsp;</TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>实际工时总成本：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="sjgs"></span>&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="16%" borderColorDark=#eeeeee align=right>实际物料总成本：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="sjwlz"></span>&nbsp;</TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>登记人&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="djr"></span>&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>登记时间：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left><span id="djsj"></span>&nbsp;</TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>复核人&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left>newer&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>复核时间：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="37%" align=left>2022-02-20 21:49:54.0&nbsp;</TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="13%" borderColorDark=#eeeeee align=right>备注&nbsp;&nbsp;&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="87%" colSpan=3 align=left><span id="bz"></span>&nbsp;</TEXTAREA> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>

<DIV class=DIV_STYLE2 id="div3" style="display: none"><TABLE cellSpacing=0 cellPadding=0 width=350 align=center bgColor=#ffffff border=0>
    <div style="position: relative;left: 60%">
        <input  onclick="tijiao11()" class="btn3_mouseout" type=button value=提交>
        <input  onclick="fanhui()" class="btn3_mouseout" type=button value=返回 id="fh">
    </div>
    <TBODY>
    <TR>
        <TD class=TABLE_STYLE6 vAlign=bottom rowSpan=2 align=center>
            <TABLE style="BORDER-TOP: #333333 1px solid; BORDER-RIGHT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BORDER-LEFT: #333333 1px solid" cellSpacing=0 cellPadding=0 width=1000 border=0>
                <TBODY>
                <TR>
                    <TD height=10 colSpan=4>
                        <TABLE width=1000>
                            <TBODY>
                            <TR>
                                <TD>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center><FONT size=4><B>生产登记单</B></FONT></TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE id=theObjTable class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>派工单编号：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><span id="pgbh"></span></TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>工序名称：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><span id="gxmc"></span></TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>负责人&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT class=INPUT_STYLE3 id="fzr" value="" name=procedure_responsible_person></TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>设计工时数：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><span id="sjgss"></span>&nbsp;</TD></TR>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>已用工时数：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT type=hidden value=0.00 name=real_labour_hour_amount>0.0&nbsp;</TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>本次工时数：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT class=INPUT_STYLE3 id="bcgss" name=labour_hour_amount></TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE id="table3" class=TABLE_STYLE5 borderColor=#000000 cellSpacing=0 borderColorDark=#eeeeee cellPadding=0 align=center borderColorLight=#848284 border=1>
                                        <TBODY>
                                        <TR class=TR_STYLE2 height=20 bgColor=#d2e9ff>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="5%" align=left>序号</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>物料名称</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>物料编号</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>设计数量</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>补充数量</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>已使用数量</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="11%" align=left>本次数量 </TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="13%" align=left>&nbsp;</TD></TR>




                                        </TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE5 height=5 align=center>&nbsp;</TD></TR></TBODY></TABLE>
                                    <TABLE class=TABLE_STYLE4 align=center>
                                        <TBODY>
                                        <TR class=TR_STYLE1 height=20>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>登记人&nbsp;&nbsp;：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><INPUT class=INPUT_STYLE3 value="" id="djr1" name=register></TD>
                                            <TD class=TD_STYLE8 borderColorLight=#848284 width="10%" borderColorDark=#eeeeee align=right>登记时间：</TD>
                                            <TD class=TD_STYLE2 borderColor=#dedbd6 width="40%" align=left><span id="djsj1"></span></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
                <TR>
                    <TD width=56 colSpan=3 noWrap></TD></TD></TR>
                <TR>
                    <TD height=100 colSpan=3 noWrap></TD>
                    <TD></TD></TR>
                <TR vAlign=bottom>
                    <TD colSpan=4 noWrap align=center></TD></TR></TD>
                <TR>
                    <TD colSpan=4 noWrap align=right></TD></TR></TBODY></TABLE></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD>
        <TD bgColor=#ffffff height=2 width=1></TD></TR>
    <TR>
        <TD bgColor=#333333 height=120 width=1></TD>
        <TD bgColor=#666666 height=120 width=1></TD>
        <TD bgColor=#999999 height=120 width=1></TD></TR>
    <TR align=right vAlign=top>
        <TD colSpan=4>
            <TABLE class=TABLE_STYLE6 cellSpacing=0 cellPadding=0 align=center border=0>
                <TBODY>
                <TR>
                    <TD bgColor=#333333 height=1></TD></TR>
                <TR>
                    <TD bgColor=#666666 height=1></TD></TR>
                <TR>
                    <TD bgColor=#999999 height=1></TD></TR></TBODY></TABLE></TD></TR>
    <TR align=right vAlign=middle>
        <TD colSpan=4></TD></TR></TBODY></TABLE></DIV>
<script>
    $(function () {
        $("#table").bootstrapTable({
            method:"post",
            contentType:"application/json",
            url:"/cha/nbcha",
            //初始页数
            pageNumber:1,
            pagination: true,
            sidePagination:"server",
            pageSize:2,
            pageList:[2,4,6,8,10],
            queryParams:function (param) {
                return {
                    page: (param.offset / param.limit) + 1,
                    pageNum: param.limit,
                }
            },
            columns:[
                {title:"生产派工单编号",field:"manufactureId",align:"center"},
                {title:"产品编号",field:"productId",align:"center"},
                {title:"产品名称",field:"productName",align:"center"},
                {title:"数量",field:"amount",align:"center"},
                {title:"出库单编号集合",field:"",align:"center"},
                {title:"登记时间",field:"registerTime",align:"center"},
                {title:"登记",field:"",align:"center", formatter:function (value, row, index) {
                        var btn2 = "<button class='btn btn-info'  onclick='dengji(" + JSON.stringify(row) + ")'>登记</button>";
                        return btn2;
                    }}
            ]
        })
    })
    function dengji(it) {
        let manufactureId = it.manufactureId;
            document.getElementById("div1").style.display='none'
            document.getElementById("div2").style.display='block'
            $.ajax({
                type:"get",
                url: "/cha/chadj/"+manufactureId,
                dataType:"json",
                success:function (data) {
                    console.log(data)
                    document.getElementById("pgd").innerText=data.manufactureId;
                    document.getElementById("cpbh").innerText=data.productId;
                    document.getElementById("cpmc").innerText=data.productName;
                    document.getElementById("sl").innerText=data.amount;
                    document.getElementById("ms").innerText=data.productDescribe;
                    document.getElementById("sjcb").innerText=data.labourCostPriceSum
                    document.getElementById("sjwlcb").innerText=data.moduleCostPriceSum;
                    document.getElementById("djr").innerText=data.register;
                    document.getElementById("djsj").innerText=data.registerTime;
                    document.getElementById("bz").innerText=data.remark;
                    chagx()
                }
            })
    }
    function chagx() {
        let productId = document.getElementById("cpbh").innerText;
        $.ajax({
            type:"get",
            url:"/cha/chagx/"+productId,
            dataType: "json",
            success:function (data) {
                for (var i=0;i<data.length;i++){
                    document.getElementById("table2").innerHTML+=
                        "<tr>"+
                        "<td class='mc'>"+data[i].procedureName+"</td>"+
                        "<td>"+data[i].labourHourAmount+"</td>"+
                        "<td>"+(data[i].realLabourHourAmount!=null?data[i].realLabourHourAmount:"0.00")+"</td>"+
                        "<td class='gsxj'>"+data[i].subtotal+"</td>"+
                        "<td class='pp'>"+(data[i].realSubtotal!=null?data[i].realSubtotal:"0.00")+"</td>"+
                        "<td>"+data[i].moduleSubtotal+"</td>"+
                        "<td class='zc' '>"+(data[i].realModuleSubtotal!=null?data[i].realModuleSubtotal:"0.00")+"</td>"+
                        "<td>"+(data[i].procedureFinishTag=='G004-0'?"<a href='#' onclick='dj("+data[i].detailsInt+","+data[i].labourHourAmount+","+data[i].subtotal+")'>登记</a>":(data[i].procedureFinishTag=='G004-2'?"待审核":(data[i].procedureFinishTag=='G004-3'?"已审核":"完成")))+"</td>"+
                        "<td class='xb'>"+(data[i].procedureTransferTag=='G005-0'?"<a href='#' data-toggle=\"modal\" data-target=\"#myModal\" onclick='gxsl("+data[i].detailsInt+")'>交接登记</a>":(data[i].procedureTransferTag=='G005-1'?"<a href='#'>已交接</a>":(data[i].procedureTransferTag==null?"<a href='#'></a>":(data[i].procedureTransferTag=='G005-2'?"完成":""))))+"</td>"+
                        "</tr>"
                }
                let wlcb = document.getElementsByClassName("zc");
                var wl=0;
                var xx1=0
                for (var i=0;i<wlcb.length;i++){
                    xx1+=parseInt(wlcb[i].innerHTML)+parseInt(wl);
                }
                document.getElementById("sjwlz").innerText=xx1
                let sjcb = document.getElementsByClassName("pp");
                var sj1=0;
                var xx2=0
                for (var i=0;i<sjcb.length;i++){
                    xx2+=parseInt(sjcb[i].innerHTML)+parseInt(sj1);
                }
                document.getElementById("sjgs").innerText=xx2
            }
        })
    }
    var a=0;
    function dj(sz,sjs,cb) {
        document.getElementById("pgbh").innerText=document.getElementById("pgd").innerText;
        document.getElementById("djr1").value=document.getElementById("djr").innerText;
        document.getElementById("djsj1").innerText=document.getElementById("djsj").innerText
        document.getElementById("div1").style.display='none'
        document.getElementById("div2").style.display='none'
        document.getElementById("div3").style.display='block'
        let parentId = document.getElementById("cpbh").innerText;
        a=cb/sjs;
      $.getJSON("http://localhost:8080/cha/djc",{detailsInt:sz,parentId:parentId},function (data) {
            console.log(data)
          for (var i=0;i<data.length;i++){
                    document.getElementById("gxmc").innerText=data[0].procedureName;
                    document.getElementById("sjgss").innerText=data[0].labourHourAmount;
                    var xx = data[i].mProcedureModules;
                for (var j=0;j<xx.length;j++){
                        document.getElementById("table3").innerHTML+="<tr>"+
                                "<td class='x1'>"+xx[j].detailsInt+"</td>"+
                            "<td>"+xx[j].productName+"</td>"+
                            "<td>"+xx[j].productId+"</td>"+
                            "<td>"+xx[j].amount+"</td>"+
                            "<td class='xx'>"+xx[j].costPrice+"</td>"+
                            "<td>0.00</td>"+
                            "<td><input type='text' class='ss'/></td>"+
                            "<td><input type='hidden' value='"+xx[j].parentId+"'></td>"+
                                "</tr>"
                }
          }
      })

    }
    function fanhui() {

        document.location="Internalproduction.jsp"
    }
    function tijiao11() {
        //实际工时数
        let value = document.getElementById("bcgss").value;
        let xx = document.getElementsByClassName("xx");
        let ss = document.getElementsByClassName("ss");
        //实际物料成本
        var xj=0;
        for (var i=0;i<xx.length;i++){
            xj+=xx[i].innerHTML*ss[i].value;
        }
        var b=a;
        //实际工时成本
        a=a*value;
        let wlcb = document.getElementsByClassName("zc");
        var wl=0;
        var xx1=0
        for (var i=0;i<wlcb.length;i++){
            xx1+=parseInt(wlcb[i].innerHTML)+parseInt(wl);
        }
        //条件
        let detailsInt = $(".x1").html()
        let productId = document.getElementById("cpbh").innerText;
        var  xx1={
            detailsInt:detailsInt,
            parentId:productId,
            realLabourHourAmount:value,
            realSubtotal:b,
            realModuleSubtotal:xj
        }
        let s = JSON.stringify(xx1);
        $.ajax({
            type:"post",
            dataType:"json",
            url:"/cha/xggx/",
            contentType: "application/json",
            data:s,
            success:function (data) {
                console.log(data)
            }
        })
        //工序名称
        let procedureName = document.getElementById("gxmc").innerText;
        //工时成本小计
        let subtotal = $(".gsxj").html();
        //负责人
        let procedureResponsiblePerson = document.getElementById("fzr").value;
        //登记人
        let register = document.getElementById("djr1").value;
        //登记时间
        let registerTime = document.getElementById("djsj1").innerText;
        var zz ={
            parentId:productId,
            detailsInt:detailsInt,
            procedureName:procedureName,
            labourHourAmount:value,
            subtotal:subtotal,
            procedureResponsiblePerson:procedureResponsiblePerson,
            register:register,
            registerTime:registerTime
        }
        let s1 = JSON.stringify(zz);
        $.ajax({
            type:"post",
            dataType:"json",
            url:"/cha/addjl/",
            contentType:"application/json",
            data: s1,
            success:function (data) {
                document.location="Internalproduction.jsp"
            }
        })
        let nodeListOf = document.getElementById("table3").querySelectorAll("tr");
        for (var i=0;i<nodeListOf.length;i++){
            let nodeListOf1 = nodeListOf[i+1].querySelectorAll("td");
            //产品编号
            let productId = document.getElementById("cpbh").innerText;
            //物料编号
            let innerText = nodeListOf1[nodeListOf.length].innerText;
            console.log(innerText)
            //本工序物料序号
            let detailsInt = nodeListOf1[nodeListOf.length-2].innerText;
            console.log(detailsInt)
            //物料名称
            let productName = nodeListOf1[nodeListOf.length-1].innerText;
            console.log(productName)
            //设计数量
            let detailsInt1 = nodeListOf1[nodeListOf.length+1].innerText;
            console.log(detailsInt)
            //本次使用数量
            let amount = nodeListOf1[nodeListOf.length+4].querySelectorAll("input")[0].value;
            console.log(amount)
            let parentId = nodeListOf1[nodeListOf.length+5].querySelectorAll("input")[0].value;
            console.log(parentId)
            var mm={
                productId:productId,
                productName:productName,
                detailsInt:detailsInt,
                amount:amount,
                parentId:parentId
            }
            let xzc = JSON.stringify(mm);
            $.ajax({
                type:"post",
                dataType:"json",
                url:"/cha/addwljl/",
                contentType:"application/json",
                data: xzc,
                success:function (data) {
                    document.location="Internalproduction.jsp"
                }
            })
        }
    }
        function gxsl(detailsInt) {
        console.log(detailsInt)
                let detailsInt1 = detailsInt;
            let realAmount = prompt("请输入数量");
            let productId = document.getElementById("cpbh").innerText;
            $.post("http://localhost:8080/cha/gxsl",{detailsInt:detailsInt1,parentId:productId,realAmount:realAmount},function (data) {
                document.location="Internalproduction.jsp"



            })
        }
</script>
</body>
</html>
